package net.biancheng.framework.web.controller;

import net.biancheng.common.core.CommonResult;
import net.biancheng.bean.SysDictData;
import net.biancheng.bean.SysRole;
import net.biancheng.service.ISysDictDataService;
import net.biancheng.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: lb
 * @date: 2024/1/12 17:48
 * @desc: 取消鉴权请求controller
 **/
@RequestMapping("/unauth")
@RestController
public class UnauthController {

    @Autowired
    private ISysRoleService sysRoleService;

    @Autowired
    private ISysDictDataService sysDictDataService;

    /**
     * 查询注册角色列表
     */
    @GetMapping("/register/role")
    public CommonResult registerRoleList() {
        List<SysRole> list = sysRoleService.selectOutsizeRoleList();
        return CommonResult.success(list);
    }

    /**
     * 根据字典类型查询字典数据列表
     */
    @GetMapping("/dictData/{dictType}")
    public CommonResult getDictData(@PathVariable String dictType)
    {
        List<SysDictData> list = sysDictDataService.selectSysDictDataListByDictType(dictType);
        return CommonResult.success(list);
    }

}
